package com.qf.bank.cardinfoapi.api;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.bank.cardinfoapi.fallback.CardInfoApiError;
import com.qf.bank.cardinfoapi.po.CardInfo;
import com.qf.bank.cardinfoapi.vo.CardInfoVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Create on 2019/12/5 15:24
 *
 * @author 飞
 */
@FeignClient(value = "cardInfo-provider", fallback = CardInfoApiError.class)
public interface CardInfoApi {
    /**
     * 分页查询
     * @param cardInfoVo
     * @return
     */

//    @RequestMapping(value = "/", method = RequestMethod.GET)
//    public IPage<CardInfo> page(@RequestParam int current, @RequestParam int size);
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public Page<CardInfo> page(@RequestBody CardInfoVo cardInfoVo);
    /**
     * 根据用户名获取用户所有的银行卡信息
     * @param userName
     * @return
     */
    @RequestMapping(value = "/name", method = RequestMethod.GET)
    public List<CardInfo> getByuserName(@RequestBody String userName);
    /**
     * 增加一条银行卡数据
     * @param cardInfo
     * @return
     */
    @RequestMapping(value = "/",method = RequestMethod.POST)
    public Boolean getInsert(@RequestBody CardInfo cardInfo);

    /**
     * 删除一条银行卡信息
     * @param cardId
     * @return
     */
    @RequestMapping(value = "/{cardId}", method = RequestMethod.DELETE)
    public Boolean deleteById(@PathVariable(value = "cardId") int cardId);

    /**
     * 修改一条银行卡信息
     * @param cardInfo
     * @return
     */
    @RequestMapping(value = "/",method = RequestMethod.PUT)
    public Boolean updateById(@RequestBody CardInfo cardInfo);
}
